﻿using System;
using UnityEngine;

// Token: 0x02000384 RID: 900
public class LightMapControl : MonoBehaviour
{
	// Token: 0x06001645 RID: 5701 RVA: 0x00095480 File Offset: 0x00093680
	public void Apply()
	{
		LightmapData[] array = new LightmapData[this.textures.Length];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = new LightmapData
			{
				lightmapDir = this.textures[i].dir,
				lightmapColor = this.textures[i].light
			};
		}
		LightmapSettings.lightmaps = array;
		if (this.meshLightMapDatas != null)
		{
			for (int j = 0; j < this.meshLightMapDatas.Length; j++)
			{
				this.meshLightMapDatas[j].Apply(this.textures);
			}
		}
		LightmapSettings.lightProbes = this.lightProbes;
	}

	// Token: 0x06001646 RID: 5702 RVA: 0x00095528 File Offset: 0x00093728
	public void RecordLightMaps()
	{
		Renderer[] componentsInChildren = base.GetComponentsInChildren<Renderer>();
		this.meshLightMapDatas = new MeshLightMapData[componentsInChildren.Length];
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			this.meshLightMapDatas[i] = new MeshLightMapData();
			this.meshLightMapDatas[i].Record(componentsInChildren[i]);
		}
		this.textures = new LightMapControl.LightTexSet[LightmapSettings.lightmaps.Length];
		for (int j = 0; j < this.textures.Length; j++)
		{
			this.textures[j] = new LightMapControl.LightTexSet();
			this.textures[j].light = LightmapSettings.lightmaps[j].lightmapColor;
			this.textures[j].dir = LightmapSettings.lightmaps[j].lightmapDir;
		}
	}

	// Token: 0x04001A03 RID: 6659
	[SerializeField]
	private LightMapControl.LightTexSet[] textures;

	// Token: 0x04001A04 RID: 6660
	[SerializeField]
	private MeshLightMapData[] meshLightMapDatas;

	// Token: 0x04001A05 RID: 6661
	[SerializeField]
	private LightProbes lightProbes;

	// Token: 0x02000385 RID: 901
	[Serializable]
	public class LightTexSet
	{
		// Token: 0x04001A06 RID: 6662
		public Texture2D light;

		// Token: 0x04001A07 RID: 6663
		public Texture2D dir;
	}
}
